package org.mindrive.system.util;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with intelliJ IDEA
 * User: mwh
 * Date: 2023/4/13
 * Time: 20:41
 * Description:
 */
public class ObjectUtil {

    /**
     * Object 对象转 List
     */
    public static <T> List<T> castList(Object obj, Class<T> clazz) {
        List<T> result = new ArrayList<T>();
        if (obj instanceof List<?>) {
            for (Object o : (List<?>) obj) {
                result.add(clazz.cast(o));
            }
            return result;
        }
        return null;
    }
}
